package com.samoiloff.ui.common {
	import flash.display.Sprite;
	import flash.geom.Rectangle;

	/**
	 * @author Samoiloff
	 */
	public class Viewport {
		
		protected var _mc	: Sprite;
		protected var _r	: Rectangle;

		public function Viewport() {
			_r = new Rectangle();
			_mc = new Sprite();
		}

		protected function update():void {
			//_mc.y = -_r.y;
			_mc.scrollRect = _r;
		}
		
		public function get x(): Number {
			return _r.x;
		}
		
		public function set x(x: Number): void {
			_r.x = x;
			update();
		}
		
		public function get y(): Number {
			return _r.y;
		}
		
		public function set y(y: Number): void {
			_r.y = y;
			update();
		}
		
		public function get width(): Number {
			return _r.width;
		}
		
		public function set width(width: Number): void {
			_r.width = width;
			update();
		}
		
		public function get height(): Number {
			return _r.height;
		}
		
		public function set height(height: Number): void {
			_r.height = height;
			update();
		}
		
	}
}
